//------------------------------------------------------------------------------
/// <copyright from='1997' to='2002' company='Microsoft Corporation'>
///    Copyright (c) Microsoft Corporation. All Rights Reserved.
///
///    This source code is intended only as a supplement to Microsoft
///    Development Tools and/or on-line documentation.  See these other
///    materials for detailed information regarding Microsoft code AFs.
///
/// </copyright>
//------------------------------------------------------------------------------
namespace UIDesigner.DesignContainers.Filters
{
	using System;
	using System.Windows.Forms;
	using System.ComponentModel.Design;
	using System.Windows.Forms.Design;
    using SharedClasses;
    using System.Diagnostics;

	/// This filter is used to catch keyboard input that is meant for the designer.
	/// It does not prevent the message from continuing, but instead merely
	/// deciphers the keystroke and performs the appropriate MenuCommand.
	public class DesignerKeystrokeMessageFilter : System.Windows.Forms.IMessageFilter
	{
        public DesignerKeystrokeMessageFilter()
		{
        }

		public bool PreFilterMessage(ref Message m)
		{
            if (m.Msg == (int)WindowsAPI.WindowsMessage.WM_KEYDOWN)
            {
                return true;
            }
            else if (m.Msg == (int)WindowsAPI.WindowsMessage.WM_CHAR)
            {
                return true;
            }

			return false;
		}
	}
}
